package org.tloss.web.spring;

import java.util.Collection;

import org.tloss.web.Constants;
import org.tloss.web.Convertor;

public class Utils {
	public static String createView(String formName, String viewName) {
		StringBuffer buffer = new StringBuffer();
		buffer.append(formName).append("#").append(viewName);
		String result = buffer.toString();
		buffer = null;
		return result;
	}

	public static boolean isEmpty(Object object) {
		if (object != null && object instanceof Collection) {
			Collection<?> collection = (Collection<?>) object;
			return collection.isEmpty();
		}
		return false;
	}

	public static Convertor getConvertor() {
		return BeanFactory.getBeanFactory().getBean(
				Constants.CURRENT_CONVERTOR, Convertor.class);
	}
}
